package repository

import (
	"context"
	"demo/domain/model"
	"demo/infra/db"

	"gorm.io/gorm"
)

type userLoginRecordRepository struct {
	db *gorm.DB
}

func (u userLoginRecordRepository) Save(ctx context.Context, entity *model.UserLoginRecord) error {
	rdb := db.GetDB(ctx, u.db)
	return rdb.WithContext(ctx).Create(entity).Error
}

// NewUserRepository 创建一个新的 Repository 实例
func NewUserLoginRecordRepository(db *gorm.DB) model.UserLoginRecordRepository {
	return &userLoginRecordRepository{db: db}
}
